import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'umi'
import { Page } from 'components'
import { Avatar, Descriptions } from 'antd'
import { t } from "@lingui/macro"
import {getNavigationTreeTitle} from "utils/tree";

@connect(({ exampleDetail }) => ({ exampleDetail }))
class ExampleDetail extends PureComponent {
  render() {
    const { exampleDetail } = this.props
    const { data,options,trees } = exampleDetail
    return (
      <Page inner>
        {/*<div className={styles.content}>{content}</div>*/}
        <Descriptions title={t`自动化样例`}>
          {/*{content}*/}
          <Descriptions.Item label={t`Id`}>{data.id}</Descriptions.Item>
          <Descriptions.Item label={t`Title`}>{data.title}</Descriptions.Item>
          <Descriptions.Item label={t`Category`}>{getNavigationTreeTitle(data.categoryId,trees.categoryId)}</Descriptions.Item>
          <Descriptions.Item label={t`样例选项`}>{options.optionId[data.optionId]}</Descriptions.Item>
          <Descriptions.Item label={t`Content`}>{data.content}</Descriptions.Item>
          <Descriptions.Item label={t`Updated Time`}>{data.updatedTime}</Descriptions.Item>
          <Descriptions.Item label={t`Created Time`}>{data.createdTime}</Descriptions.Item>
          <Descriptions.Item label={t`Apply Status`}>{options.applyStatus[data.applyStatus]}</Descriptions.Item>
          <Descriptions.Item label={t`Status`}>{options.status[data.status]}</Descriptions.Item>
          <Descriptions.Item label={t`User Id`}>{data.userId}</Descriptions.Item>
          <Descriptions.Item label={t`Open Id`}>{data.openId}</Descriptions.Item>
          <Descriptions.Item label={t`Dict Int`}>{options.dictInt[data.dictInt]}</Descriptions.Item>
        </Descriptions>
      </Page>
    )
  }
}

ExampleDetail.propTypes = {
  exampleDetail: PropTypes.object,
}

export default ExampleDetail
